//
//  HTTPRequestManager.h
//  ZhaoQiPei
//
//  Created by 找汽配ios开发 on 15/11/28.
//  Copyright © 2015年 祥运. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "XYSingleton.h"

typedef NS_ENUM(NSInteger, ErrorCode);
@class MBProgressHUD;
@protocol HTTPRequestManagerDelegate;

@interface HTTPRequestManager : NSObject

@property (nonatomic, weak) id<HTTPRequestManagerDelegate> delegate;

AS_SINGLETON(HTTPRequestManager)

+ (MBProgressHUD *)showProgressHUD;
+ (void)hideProgressHUD:(MBProgressHUD *)hud;

@end

@protocol HTTPRequestManagerDelegate <NSObject>

- (MBProgressHUD *)httpRequestManagerShowProgressHUD;
- (void)httpRequestManagerHideProgressHUD:(MBProgressHUD *)hud;
/** 代理方法，当网络请求出现警告时，该方法被调用 */
- (void)httpRequestManagerDidRequestWarnWithContent:(NSString *)content;
/** 代理方法，当网络请求出现错误时，该方法被调用 */
- (void)httpRequestManagerDidRequestErrorWithErrorCode:(ErrorCode)errorCode content:(NSString *)content;
/** 代理方法，当网络请求失败时，该方法被调用 */
- (void)httpRequestManagerDidRequestFailureWithError:(NSError *)error;
/** 代理方法，当网络请求会话失效时，该方法被调用 */
- (void)httpRequestManagerDidInvalid;
/** 代理方法，当网络请求取消时，该方法被调用 */
- (void)httpRequestManagerDidCancel;
/** 代理方法，当网络请求超时时，该方法被调用 */
- (void)httpRequestManagerDidTimeOut;
/** 代理方法，当网络断开时，该方法被调用 */
- (void)httpRequestManagerDidOffline;

@end
